<template>
  <div class="container">
    <el-dialog
      class="dialog"
      :title="
        particularsDialogs.dialogType === 'edit' ? '修改入库单' : '入库单详情'
      "
      :visible.sync="particularsDialogs.centerDialogVisible"
      center
      width="60%"
      :lock-scroll="true"
      @open="getData"
    >
      <el-form
        label-width="80px"
        style="margin: 10px; width: auto"
        label-position="left"
      >
        <!-- <el-form-item label="购货单：" prop="value">
          <el-input v-model="formData.bo_serialno" :disabled="true"></el-input>
        </el-form-item>-->
      </el-form>
      <el-table
        :data="formData"
        border
        style="width: 100%"
        empty-text="暂无数据"
      >
        <el-table-column
          prop="warehouse_name"
          label="仓库"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="goods_name"
          label="商品"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="erp_goods_code"
          label="编号"
          align="center"
        ></el-table-column>
        <!-- <el-table-column prop="goods_num" label="商品数量" align="center"></el-table-column>
        <el-table-column prop="goods_price" label="商品价格" align="center"></el-table-column>-->
        <el-table-column
          prop="unit"
          label="单位"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="spec"
          label="规格"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="qty"
          label="箱数"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="inp_num"
          label="数量"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="purchase_price"
          label="价格"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="amount"
          label="总价"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="remark"
          label="备注"
          align="center"
        ></el-table-column>
      </el-table>
      <el-table
        :data="expenses_info"
        border
        style="width: 100%"
        empty-text="暂无数据"
      >
        <el-table-column
          prop="opctions"
          label="配送方式"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="expenses"
          label="配送价格"
          align="center"
        ></el-table-column>
      </el-table>
      <el-form
        label-width="80px"
        style="margin: 10px; width: 400px"
        label-position="left"
      >
        <el-form-item label="类型：">
          <el-input v-model="is_normal" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="采购员：">
          <el-input v-model="buyer" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="备注：">
          <el-input
            type="textarea"
            v-model="exp_remark"
            :disabled="true"
          ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="confirm()">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { particularsStotage } from "@/api/putStorage/putStotageList";
export default {
  props: {
    particularsDialogs: Object,
  },
  data() {
    return {
      formData: [],
      expenses_info: [],
      buyer: "",
      exp_remark: "",
      is_normal: "",
    };
  },
  methods: {
    confirm() {
      this.particularsDialogs.centerDialogVisible = false;
    },
    getData() {
      this.formData = [];
      let data = {
        id: this.particularsDialogs.id,
      };
      particularsStotage(data).then((res) => {
        if (res.code == 0) {
          this.formData.push(res.data.info);
          this.buyer = res.data.info.buyer;
          this.is_normal =
            res.data.info.is_normal == 1 ? "正常结算" : "非正常结算";
          this.exp_remark = res.data.info.exp_remark;
          res.data.info.expenses_info.forEach((res) => {
            res.opctions = res.type == 1 ? "运费" : "其他费用";
          });
          this.expenses_info = res.data.info.expenses_info;
        }
      });
    },
  },
};
</script>
<style scoped>
.pagination {
  text-align: right;
  padding: 10px;
}
</style>